Implementing Campaign Manager - External Integrations


Using The JSON Decoder Plugin

Procedure

  1. Start Spoon by navigating to your Kettle directory and running spoon.bat. Note that the plugin is available only as a transformation step; it is not available as a Job plugin.
  2. Create a new Transformation. Select File > New >Transformation.
  3. In the Design tab, select the Alterian category, then select the Json Decoder plugin and drag it to the transformation panel.
  4. In the Design tab, select a source of JSON data.
  5. Configure the data grid tool with one field of type String on the Meta tab, for example 'Message'.
  6. Populate the Data tab with the JSON object strings you require. The JSON objects can be arbitrarily complex, and do not have to be the same as each other.

    Note that the data grid can be replaced with any other step that generates a string field containing JSON, or that reads JSON from a file.
  7. Join the Data Grid to the Json Decoder.
  8. Save the transformation.
  9. Open the Json decoder and select the field that contains JSON from the Field to decode drop-down menu.


  1. Select the Fields tab and click the Get Fields button. The inputs to this step will run and the data is parsed to the JSON decoder step.
  2. A results dialog shows the columns decoded from the JSON. If you have a large dataset or a continuous feed of JSON, you can limit the number of input rows scanned.
    In this example, two columns of data have been detected called 'a' and 'b'. The JSON Decoder guesses the data types, but you can change them if the guess is incorrect. The Required column allows you to discard certain decoded JSON objects if they do not fulfill your entered requirements. The default value is Allowed.

  3. If you do not want to decode a particular field, select the row and click delete.
  4. Add a text file output node to the transformation, connect it to the transformation and click the Get Fields button. In the example shown below, the available fields are the original JSON (Message) plus any decoded fields (a and b).
  5. Select the fields you want to output and where you would like to save the file to.
  6. Save and run the transformation.
  7. The output file should contain the decoded values of all the JSON objects in the original Data Grid. In the example show below, the original JSON message is included for comparison.

Example

Your initial transformation should look like this:


  Online & Instructor-Led Courses | Training Videos | Webinar Recordings
© Alterian. All Rights Reserved. | Privacy Policy | Legal Notice